Skip to content

feat(FR-2608): Vite production build with vite-plugin-pwa service worker#6873

Merged
graphite-app[bot] merged 1 commit intomainfrom
04-20-feat_fr-2608_vite_production_build_with_vite-plugin-pwa_service_worker
Apr 30, 2026
Merged

feat(FR-2608): Vite production build with vite-plugin-pwa service worker#6873
graphite-app[bot] merged 1 commit intomainfrom
04-20-feat_fr-2608_vite_production_build_with_vite-plugin-pwa_service_worker

Conversation

@nowgnuesLee
Copy link
Copy Markdown
Contributor

@nowgnuesLee nowgnuesLee commented Apr 22, 2026

Resolves #6811(FR-2608)

Summary

Production build via Vite + vite-plugin-pwa service worker. This is the point where vite build produces a complete deployable build/ directory.

Build output (new layout):

  • build/index.html — built from project-root index.html via the transformIndexHtml hook
  • build/assets/*.js — hashed chunks (Vite default)
  • build/sw.js — service worker generated by vite-plugin-pwa (generateSW strategy)
  • build/workbox-*.js — workbox runtime

PWA plugin options mirror the craco-era workbox-webpack-plugin GenerateSW call (craco.config.cjs:390-400):

  • strategies: 'generateSW' + filename: 'sw.js'
  • injectRegister: false — the existing registration script in index.html:126-131 stays in charge (preserves legacy behaviour; we do not opt into registerType: 'autoUpdate').
  • skipWaiting: true, clientsClaim: true
  • maximumFileSizeToCacheInBytes: 5 MiB
  • globIgnores: ['**/*.map', '**/asset-manifest.json']

Test plan

  • pnpm run vite:build completes without errors
  • build/sw.js generated, precaches ~460 entries (~22 MB)
  • SW registration path in index.html still resolves

Follow-up (PR #6877)

The plugin also emits manifest.webmanifest by default, which competes with the repo's own manifest.json. That's disabled in the follow-up fix(FR-2608) PR further up the stack.

Stack

Builds on FR-2610.

Copy link
Copy Markdown
Contributor Author

nowgnuesLee commented Apr 22, 2026


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • flow:merge-queue - adds this PR to the back of the merge queue
  • flow:hotfix - for urgent changes, fast-track this PR to the front of the merge queue

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has required the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 22, 2026

Coverage report for ./react

St.
Category Percentage Covered / Total
🔴 Statements 8.11% 1858/22905
🔴 Branches 7.35% 1187/16156
🔴 Functions 4.81% 296/6154
🔴 Lines 7.88% 1749/22190

Test suite run success

865 tests passing in 40 suites.

Report generated by 🧪jest coverage report action from 5dddc64

@nowgnuesLee nowgnuesLee force-pushed the 04-20-feat_fr-2610_vite_dev-reload_plugin_for_i18n___theme___config.toml_file_changes branch from 5c37f96 to 5b738cf Compare April 27, 2026 13:57
@nowgnuesLee nowgnuesLee force-pushed the 04-20-feat_fr-2608_vite_production_build_with_vite-plugin-pwa_service_worker branch from e36eac7 to 282a1ad Compare April 27, 2026 13:57
@nowgnuesLee nowgnuesLee marked this pull request as ready for review April 28, 2026 04:25
Copilot AI review requested due to automatic review settings April 28, 2026 04:25
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Introduces production vite build support for the React WebUI, including generating a Workbox-based service worker via vite-plugin-pwa, and adjusts the HTML transform pipeline so the project-root index.html remains the authoritative template.

Changes:

  • Add vite-plugin-pwa (GenerateSW strategy) to produce build/sw.js and workbox runtime assets.
  • Make transformIndexHtml dev/build-aware while always operating on the project-root index.html (preserving {{nonce}} in production builds).
  • Add a minimal react/index.html stub entry and a vite:build script in react/package.json.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
react/vite.config.ts Adds VitePWA SW generation and updates transformIndexHtml to use the project-root HTML template consistently.
react/package.json Adds vite:build script and vite-plugin-pwa dev dependency.
react/index.html Adds a Vite entry stub HTML (actual content replaced by projectRootStaticPlugin).
react/VITE_POC_NOTES.md Updates PoC notes to document production build + SW generation behavior.
pnpm-lock.yaml Locks new vite-plugin-pwa dependency and transitive additions.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Comment thread react/vite.config.ts
@nowgnuesLee nowgnuesLee force-pushed the 04-20-feat_fr-2610_vite_dev-reload_plugin_for_i18n___theme___config.toml_file_changes branch from 5b738cf to 3a0179a Compare April 28, 2026 05:02
@nowgnuesLee nowgnuesLee force-pushed the 04-20-feat_fr-2608_vite_production_build_with_vite-plugin-pwa_service_worker branch from 282a1ad to 2700534 Compare April 28, 2026 05:02
@nowgnuesLee nowgnuesLee force-pushed the 04-20-feat_fr-2610_vite_dev-reload_plugin_for_i18n___theme___config.toml_file_changes branch from 3a0179a to b404929 Compare April 28, 2026 05:15
@nowgnuesLee nowgnuesLee force-pushed the 04-20-feat_fr-2608_vite_production_build_with_vite-plugin-pwa_service_worker branch from 2700534 to 6b87d63 Compare April 28, 2026 05:15
@nowgnuesLee nowgnuesLee force-pushed the 04-20-feat_fr-2610_vite_dev-reload_plugin_for_i18n___theme___config.toml_file_changes branch from b404929 to d068319 Compare April 28, 2026 05:19
@nowgnuesLee nowgnuesLee force-pushed the 04-20-feat_fr-2608_vite_production_build_with_vite-plugin-pwa_service_worker branch 2 times, most recently from aa6796c to 98ef760 Compare April 28, 2026 05:25
@nowgnuesLee nowgnuesLee force-pushed the 04-20-feat_fr-2610_vite_dev-reload_plugin_for_i18n___theme___config.toml_file_changes branch from d068319 to 2c4b344 Compare April 28, 2026 05:25
@yomybaby yomybaby force-pushed the 04-20-feat_fr-2610_vite_dev-reload_plugin_for_i18n___theme___config.toml_file_changes branch from 2c4b344 to a2b2a81 Compare April 30, 2026 12:08
@yomybaby yomybaby force-pushed the 04-20-feat_fr-2608_vite_production_build_with_vite-plugin-pwa_service_worker branch from 98ef760 to 8718eb8 Compare April 30, 2026 12:08
@graphite-app
Copy link
Copy Markdown

graphite-app Bot commented Apr 30, 2026

Merge activity

…ker (#6873)

Resolves #6811(FR-2608)

## Summary

Production build via Vite + `vite-plugin-pwa` service worker. This is the point where `vite build` produces a complete deployable `build/` directory.

**Build output** (new layout):
- `build/index.html` — built from project-root `index.html` via the `transformIndexHtml` hook
- `build/assets/*.js` — hashed chunks (Vite default)
- `build/sw.js` — service worker generated by `vite-plugin-pwa` (generateSW strategy)
- `build/workbox-*.js` — workbox runtime

**PWA plugin options** mirror the craco-era `workbox-webpack-plugin` GenerateSW call (`craco.config.cjs:390-400`):
- `strategies: 'generateSW'` + `filename: 'sw.js'`
- `injectRegister: false` — the existing registration script in `index.html:126-131` stays in charge (preserves legacy behaviour; we do not opt into `registerType: 'autoUpdate'`).
- `skipWaiting: true`, `clientsClaim: true`
- `maximumFileSizeToCacheInBytes: 5 MiB`
- `globIgnores: ['**/*.map', '**/asset-manifest.json']`

## Test plan

- [x] `pnpm run vite:build` completes without errors
- [x] `build/sw.js` generated, precaches ~460 entries (~22 MB)
- [x] SW registration path in `index.html` still resolves

## Follow-up (PR #6877)

The plugin also emits `manifest.webmanifest` by default, which competes with the repo's own `manifest.json`. That's disabled in the follow-up `fix(FR-2608)` PR further up the stack.

## Stack

Builds on FR-2610.
@graphite-app graphite-app Bot force-pushed the 04-20-feat_fr-2610_vite_dev-reload_plugin_for_i18n___theme___config.toml_file_changes branch from a2b2a81 to 19e4114 Compare April 30, 2026 12:14
@graphite-app graphite-app Bot force-pushed the 04-20-feat_fr-2608_vite_production_build_with_vite-plugin-pwa_service_worker branch from 8718eb8 to 5dddc64 Compare April 30, 2026 12:14
Base automatically changed from 04-20-feat_fr-2610_vite_dev-reload_plugin_for_i18n___theme___config.toml_file_changes to main April 30, 2026 12:27
@graphite-app graphite-app Bot merged commit 5dddc64 into main Apr 30, 2026
8 checks passed
@graphite-app graphite-app Bot deleted the 04-20-feat_fr-2608_vite_production_build_with_vite-plugin-pwa_service_worker branch April 30, 2026 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100~500 LoC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Vite PoC Phase 2: production build + Workbox PWA (vite-plugin-pwa)

2 participants